<template>
  <div class="hotMovier">
    <header>
      <div class="back">
        <van-icon name="arrow-left" size="22" color="black" @click="back" />
      </div>
      <div class="title">全球精选</div>
      <div></div>
    </header>
    <div class="index" v-if="vmoviers">
      <UserLikeItem
        v-for="(vmovier, index) in vmoviers"
        :key="index"
        :like="vmovier.children[0].model"
      />
    </div>
  </div>
</template>

<script>
import UserLikeItem from "@/components/UserLikeItem.vue";

export default {
  components: {
    UserLikeItem,
  },
  name: "HotMovier",
  data() {
    return {
      vmoviers: null,
    };
  },
  created() {
    this.$toast.loading({
      message: "加载中...",
      forbidClick: true,
      duration: 0,
    });
    this.$axios.get("https://apis.netstart.cn/xpc/home/vmovier").then((res) => {
      // console.log(res.data.data);
      this.vmoviers = res.data.data.children;
      this.$toast.clear();
    });
  },
  methods: {
    back() {
      window.history.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.hotMovier {
  padding: 0 7.5px;
  padding-top: 60px;
  padding-bottom: 10px;
  background-color: #f7f7f7;

  header {
    background-color: white;
    border-bottom: 1px solid #f2f2f2;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    height: 50px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    > div {
      width: 33%;
    }

    .back {
      i {
        margin-left: 15px;
      }
    }

    .title {
      font-size: 20px;
      font-weight: bold;
      text-align: center;
    }
  }
}
</style>
